package jdbc;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class Text3 {
    public static void main(String[] args) {
        try (
            Connection connection = DBUtil.getConnection();
        ){
          Statement statement = connection.createStatement();
          String sql = "UPDATE student1 " +
                       "SET age=age+1 " +
                       "WHERE name LIKE 'test%'";
          int count = statement.executeUpdate(sql);
          if(count>0){
              System.out.println("影响了表中"+count+"条数据");
          }
            System.out.println("执行完毕");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
